/**
 * Created by Amaris on 2016/10/8.
 */
var express = require('express');
var router = express.Router();
var conf = require('config');
var util = require('../../utils/util.js');

router.get('/', function (req, res) {
    var params = req.query;
    if(!params.email || !params.password) {
        res.send(util.getErrorRes('400','缺少必要参数'));
        return;
    }
    var user = conf.get('admin');
    if(params.email == user.username && params.password == user.password) {
        req.session.uid = user.uid;
        res.send(util.getSuccessRes());
    } else {
        res.send(util.getErrorRes("400","邮箱或密码错误"));
    }
});

module.exports = router;